package com.backstage.common.base.page;

import java.util.List;
import java.util.Map;

/**
 * @TODO 分页
 * @Author:阮雪峰
 * @Date：2017/7/23 11:22
 * @pagekage: com.backstage.common.base.page
 * @project: authority
 */
public class Page<T> {
    private int pageNo = 1;//当前页
   // private int col;
    private int pageSize = 2;//每页记录数
    private int totalColumn;//总记录输
    //private int totalPage;//总页数

    private Map<String, Object> obj;
    private List<T> data;

    public int getCol(){
        return (pageNo - 1) * pageSize;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalColumn() {
        return totalColumn;
    }

    public void setTotalColumn(int totalColumn) {
        this.totalColumn = totalColumn;
    }

    public int getTotalPage() {
        return totalColumn%pageSize == 0?(totalColumn/pageSize):(totalColumn/pageSize + 1);
    }

    public Map<String, Object> getObj() {
        return obj;
    }

    public void setObj(Map<String, Object> obj) {
        this.obj = obj;
    }
}
